const Sequelize = require('sequelize')
const sequelize = require('../config/index')
const User = require('./user').User
let Withdraw = sequelize.define('withdraw',{
    id:{
        type:Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment:'id',
    },
    user_name:{
        type:Sequelize.STRING,
        comment:'用户名'
    },
    amt:{
        type:Sequelize.INTEGER,
        defaultValue:0,
        comment:'提现',
    },
    type:{
        type:Sequelize.STRING,
        defaultValue:'提现到微信',
        comment:'提现方式'
    },
    tag:{
        type:Sequelize.TEXT,
        defaultValue:'提现',
        comment:'提现标签',
    },
    des:{
        type:Sequelize.STRING,
        comment:'描述',
    },
    // order:{
    //     type:Sequelize.STRING,
    //     defaultValue:'',
    // },
    status:{
        type:Sequelize.INTEGER,
        defaultValue:0,
        comment:'提现状态',
    },
    isDel:{
        type:Sequelize.STRING,
        defaultValue:0,
        comment:'是否已删除'
    },
},{
    // freezeTabelName 为 true 时不会在库中映射表时增加复数表名
    // 该选项为 true 时，user 在映射时映射成 user，而为 false 时会映射成users
    freezeTableName: true,
})
Withdraw.belongsTo(User,{foreignKey: "uid"});
// Skill.belongsToMany(User, {through : 'userSkill'});
//这会创建一个新模型UserProject,其中projectId和userId两个外键。定义through选项后，Sequelize会尝试自动生成名字。
//在本例中，会为User添加方法getUsers,setUsers,addUser,addUsers到Project中。getProjects,setProjects,addProject,addProjects到User中.


let withdraw = Withdraw.sync();

module.exports = Withdraw

